package com.wlw.admin.openeye.mvp.presenter

import com.wlw.admin.openeye.base.BasePresenter
import com.wlw.admin.openeye.mvp.contract.HotTabContract
import com.wlw.admin.openeye.mvp.model.HotTabModel
import com.wlw.admin.openeye.net.exception.ExceptionHandle

class HotTabPresenter : BasePresenter<HotTabContract.View>(), HotTabContract.Presenter {
    private val hotTabModel by lazy {
        HotTabModel()
    }

    override fun getTabInfo() {
        checkViewAttached()
        mRootView?.showLoading()
        val disposable = hotTabModel.getTabInfo().subscribe({ tabInfo ->
            mRootView?.setTabInfo(tabInfo)
        }, { t ->
            mRootView?.showError(ExceptionHandle.handleException(t), ExceptionHandle.errorCode)
        })
        addSubscription(disposable)
    }
}